﻿<!doctype HTML>
<html>
<head>
	<!-- Set browser to Edge-->
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<!-- Set charset -->
	<meta charset="utf-8" />
	<!-- Title (normally not displayed)-->
	<title>Registry Preview Editor</title>
	<style>
		/* Fits content to window size */
		html, body {
			padding: 0;
		}

		#container, .monaco-editor {
			position: fixed;
			height: 100%;
			left: 0;
			top: 0;
			right: 0;
			bottom: 0;
		}

		.overflowingContentWidgets {
			/*Hides alert box */
			display: none !important
		}
	</style>
</head>

<body>
	<!-- Container for the editor -->
	<div id="container"></div>
	<!-- Script -->
	<script src="http://PowerToysLocalMonaco/monacoSRC/min/vs/loader.js"></script>
	<script type="module">
        import { registerAdditionalLanguages } from 'http://PowerToysLocalMonaco/monacoSpecialLanguages.js';
        import { customTokenThemeRules } from 'http://PowerToysLocalMonaco/customTokenThemeRules.js';
        require.config({ paths: { vs: 'http://PowerToysLocalMonaco/monacoSRC/min/vs' } });
		require(['vs/editor/editor.main'], async function () {
            await registerAdditionalLanguages(monaco)

            const editor = monaco.editor.create(document.getElementById('container'), {
				automaticLayout: true,
				language: 'reg',
                minimap: { enabled: false },
            });

            window.onresize = () => {
                editor.layout();
			};

            editor.getModel().onDidChangeContent((event) => {
                window.chrome.webview.postMessage({ 'id': 'contentChanged', 'content': editor.getValue() });
			});

			editor.focus();

            window.editor = editor;
		});      
	</script>
</body>
</html>
